<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.ejoysoft.wlanyz.business.Ap,com.ejoysoft.common.Constants,com.ejoysoft.util.ParamUtil"%>
<%@ include file="../include/jsp/head.jsp"%>
<%
try{
    Ap obj=new Ap(globa,true);
    String strUrl="ap_list.jsp";
    String device_Id=ParamUtil.getString(request,"device_Id","");
   
    if(action.equals(Constants.DELETE_STR)){
    	//System.out.println(action+"aaaaaaaaa");
    	String[] aryDevice_Id = ParamUtil.getStrArray(request, "device_Id");
    	
    	for (int i = 0; i < aryDevice_Id.length; i++) {
	    	obj.delete("where device_Id ='"+aryDevice_Id[i]+"'",device_Id);
	    	
    	}
    	globa.dispatch(true, strUrl);
	} else {
	    if(action.equals(Constants.ADD_STR)) {

	    String strMac_Addr=ParamUtil.getString(request,"strMac_Addr","");
	  	 String strHotSpot=ParamUtil.getString(request,"strHotPotName","");
             if(obj.getCount(" where strMac_Addr='" + strMac_Addr.replaceAll(" ","") + "'")>0){
                globa.closeCon();
                out.print("<script>alert('已经存在MAC地址"+strMac_Addr.replaceAll(" ","")+", 请输入其他MAC地址');window.location.href = 'ap_add.jsp';</script>");
                
                
             }else{
          
            globa.dispatch(obj.add(strMac_Addr),strUrl);
            System.out.println(action+strHotSpot+"=========================");
           
             }	    
		}
		else if(action.equals(Constants.UPDATE_STR)){
            //String  strMac_Addr=ParamUtil.getString(request,"strMac_Addr","");
   
             if(strUrl.indexOf(".jsp")>=0)
                 strUrl=strUrl+"?device_Id="+device_Id;
                 
                 globa.dispatch(obj.update(device_Id),strUrl);
                 System.out.println(strUrl+"aaaaaaaaa222222222222222");
      }
     //System.out.println(action+"aaaaaaaaa");
	}
    //关闭数据库连接对象
    globa.closeCon();
    }catch(Exception e){e.printStackTrace();}
%>